//
//  APCoinControl.m
//  AqualPolo
//
//  Created by dong on 2024/5/7.
//

#import "APCoinControl.h"

@implementation APCoinControl

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        UIImageView *backgroundImageView = [[UIImageView alloc] init];
        backgroundImageView.image = [UIImage imageNamed:@"me_coin_bg"];
        [self addSubview:backgroundImageView];
        [backgroundImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(self);
        }];
        _imageView = [[UIImageView alloc] init];
        _imageView.image = [UIImage imageNamed:@"me_coin_icon"];
        [self addSubview:_imageView];
        [_imageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).offset(18);
            make.size.mas_equalTo(CGSizeMake(22, 24));
            make.centerY.equalTo(self);
        }];
        
        _titleLabel = [[UILabel alloc] init];
        _titleLabel.textColor = [UIColor whiteColor];
        _titleLabel.font = [LYFont fontWithSize:16 fontName:LYFontNamepfb];
        _titleLabel.textAlignment = NSTextAlignmentLeft;
        _titleLabel.text = @"0";
        [self addSubview:_titleLabel];
        [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.bottom.equalTo(self);
            make.left.equalTo(_imageView.mas_right).offset(6);
            make.right.equalTo(self).offset(-18);
        }];
    }
    return self;
}

@end
